import { REG } from "@/data/locations";
import { StyleMgr } from "../libs/core/styleOperation";
import styleAnimations from "@/data/globalStyleValues";

const entry = () => {
  return StyleMgr.add(
    "navBar",
    `
    ${styleAnimations}
    #header-guide > li.guide-item.guide-msg:hover > div,
    #header-guide > li.guide-item.guide-feed:hover > div,
    #header-guide > li.guide-item.guide-cretive:hover > div,
    #header-guide > li.guide-item.guide-upload:hover > div,
    #header-guide > li.download-app:hover,
    #header-guide > li.guide-item.guide-user:hover > div,
    #header-guide > li.guide-item.guide-history:hover > div {
        animation: fade-in;
        animation-duration: 0.5s;
        -webkit-animation: fade-in .4s;
    }
    div.second-container,
    div.header-sub-nav {
        animation: fadeInDown;
        animation-duration: 0.3s;
        -webkit-animation: fadeInDown .3s;
    }
    .top-nav .first-container .first-item .second-container ul {
        background-color: #fff;
        box-shadow: 0 3px 3px rgba(0, 0, 0, .3);
    }
    .top-nav .first-container .first-item .second-container {
        background-color: #fff0;
        box-shadow: none;
        padding-bottom: 5px;
    }
    .second-link {
        transition: all .2s ease;
    }
    .second-link:hover {
        border-bottom: 2px solid var(--acred);
        transition: all .1s ease;
    }
    #pagelet_navigation > div > ul > li > div > ul > li:last-child {
        margin: 0px;
    }
    /*创作者中心入口*/
    [data-c-w-header] .header-guide .guide-item.guide-cretive .guide-item-con {
        width: 90px;
    }
    [data-c-w-header] .header-guide .guide-item li:hover {
        background-color: #f4f4f4 !important;
    }
    [data-c-w-header] .header-guide .guide-item-con {
        text-align: center !important;
    }
    [data-c-w-header] .header-guide .guide-item ul {
        padding: 0 0;
    }
    /*历史*/
    #header-guide > li.guide-item.guide-history > div > ul {
        padding: 0px 12px;
    }
    /*消息*/
    [data-c-w-header] .header-guide .guide-msg .guide-item-con {
        width: 110px;
    }
    /* 投稿下拉菜单 */
    [data-c-w-header] .header-guide .guide-item.guide-upload .guide-item-con {
        width: 100px;
    }
    [data-c-w-header] .header-guide .guide-item-con {
        font-size: 15px;
    }
    #header-guide > li.guide-item.guide-upload > div > ul > li {
        padding: 10px 0;
    }
    #header-guide > li.guide-item.guide-upload > div > ul > li:hover {
        background-color: #f4f4f4 !important;
    }
    `
  );
};

const module: ModulesConstructure = {
  name: "navBar",
  type: "style",
  start: entry,
  condition: {
    siteMatch: [
      REG.index,
      REG.videoAndBangumi,
      REG.article,
      REG.articleDetail,
      REG.partIndex,
    ],
    pageLifeProbeRequire: undefined,
  },
  optionUI: {
    enable: {
      type: "switch",
      department: "common",
      onActivate: () => {
        return true;
      },
      onDeactivate: () => {
        return false;
      },
    },
  },
};
export default module;
